//公共请求的方法
import base from "./base"
import axios from "@/utils/request"
import axios_y from "axios"
import {login, permission} from './login/login'

const api = {
    //首页顶部的统计
    totalInfo() {
        return axios.get(base.totalInfo)
    },
    //首页的订单数据
    orderInfo() {
        return axios.get(base.orderInfo)
    },
    //首页图表数据
    format() {
        return axios.get(base.format)
    },

    // 产品列表
    projectList(params) {
        return axios.get(base.projectList, {params})
    },

    // 搜索接口
    search(params) {
        return axios.get(base.search, params);
    },

    deleteItemById(params) {
        return axios.get(base.deleteItemById, {params});
    },
    //商品添加，类目选择
    selectItemCategoryByParentId(params) {
        return axios.get(base.selectItemCategoryByParentId, {params});
    },

    insertTbItem(params) {
        return axios_y.post(base.insertTbItem, params);
    },

    //批量删除
    batchDelete(params) {
        return axios.get(base.batchDelete, {params})
    },
    updateTbItem(params) {
        return axios_y.post(base.updateTbItem, params);
    },
    itemCategory() {
        return axios.get(base.itemCategory);
    },
    /* 
      新增子级类目
      params={cid name}
    */
    insertItemCategory(params) {
        return axios.get(base.insertItemCategory, {params});
    },
    /* 
        修改类目
        {id,name}
      */
    updateCategory(params) {
        return axios.get(base.updateCategory, {params});
    },

    /* 
        删除类目
        {id}
        */
    deleteContentCategoryById(params) {
        return axios.get(base.deleteContentCategoryById, {params});
    },
    /* 
        一级类目新增
        {name}
         */
    insertCategory(params) {
        return axios.get(base.insertCategory, {params});
    },

    /* 
    订单列表
    */
    orderList(params) {
        return axios.get(base.orderList, {params});
    },
    /* 
      订单汇总---ids=''
      */
    changeStatus(params) {
        return axios.get(base.changeStatus, {params});
    },
    /* 
      汇总清单
      {page}
       */
    collect(params) {
        return axios.get(base.collect, {params});
    },
    /* 
        撤销汇总
        {id}
      */
    cancel(params) {
        return axios.get(base.cancel, {params});
    },
    // /* 
    //     订单详情
    //     {id}
    //   */
    getDetail(params) {
        return axios.get(base.detail, { params });
    },
    //登录
    login,
    permission,


}
export {permission}
export default api;